<?php
class Upload{
	// $_FILES array
	private $file;
	// file types allow to upload
	public $type = array('jpg','gif','txt');
	// max size allow to upload, unit: kb
	public $size = 8192;

	public $override = false;

	public $savePath = './';

	public $saveName = '';

	private $error = false;

	private $errMsg = array(
				0 => "File field can't be null";
			);

	public function __construct($opts=NULL,$field="Filedata"){
		if( empty($field) ){
			$this->error = $errMsg[0];
			return false;
		}
		$this->file = $_FILES[$field];
		if( is_array($opts) ){
			foreach( $opts as $k=>$v ){
				if( property_exists($this,$k) ) $this->$k = $v;
			}
		}
	}

	public 

	public function get($var){
		var_dump($this->$var);
	}

}

$opts = array('size'=>20480);
$u = new Upload($opts,'Filedata');
$u->get('size');
